package com.hsmw.api.service;


import com.hsmw.api.mapper.HsmwJobCollectionMapper;
import com.hsmw.api.mapper.HsmwLeasingCompanyRuleMapper;
import com.hsmw.common.base.BaseService;
import com.htn.common.core.utils.StringUtils;
import com.hsmw.domain.HsmwJobCollection;
import com.hsmw.domain.HsmwLeasingCompanyRule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class HsmwLeasingCompanyRuleService extends BaseService<HsmwLeasingCompanyRuleMapper, HsmwLeasingCompanyRule> {


    @Autowired
    private HsmwLeasingCompanyRuleService hsmwLeasingCompanyRuleService;

    public boolean saveOrUpdateRule(HsmwLeasingCompanyRule hsmwLeasingCompanyRule) {

        if(StringUtils.isNotBlank(hsmwLeasingCompanyRule.getId())){

            boolean suc = hsmwLeasingCompanyRuleService.updateById(hsmwLeasingCompanyRule);
            return suc;
        }else {
            boolean suc = hsmwLeasingCompanyRuleService.save(hsmwLeasingCompanyRule);
            return suc;
        }
    }
}
